﻿using Cognex.VisionPro;
using Cognex.VisionPro.ToolBlock;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Windows;
using YJYpublicClass;
using System.ComponentModel;
using YJYpublicClass.DataStruct;

namespace YJYpublicClass.Model
{
    [Serializable]
    public class CustomModel
    {
        //模型类，模型类包括，插针定义，对应的流程VPP，参考基准点，
        //
        public string _款式名称 { get; set; } = "新款式";
        public int _款式序号 { get; set; } = 0;
        //工程路径外部不可更改
        // public int _显示索引 { get; set; } = 0;
        public float _相机1曝光时间 { get; set; } = 5000;
        public float _相机2曝光时间 { get; set; } = 5000;
        public float _相机3曝光时间 { get; set; } = 5000;


        //相机1VPP
        public CogToolBlock CCD1vppblock = new CogToolBlock();

        //相机2VPP
        public CogToolBlock CCD2vppblock = new CogToolBlock();

        //相机3VPP
        public CogToolBlock CCD3vppblock = new CogToolBlock();
        //定位参数

        //相机1VPP
        [NonSerialized]
        public CogToolBlock _B_CCD1_端盖测量工具 = null;

        [NonSerialized]
        public CogToolBlock _B_CCD1_中结测量工具 = null;

        [NonSerialized]
        public CogToolBlock _B_CCD1_尾结测量工具 = null;


        [NonSerialized]
        public CogToolBlock _B_CCD2_端盖测量工具 = null;

        [NonSerialized]
        public CogToolBlock _B_CCD2_中结测量工具 = null;

        [NonSerialized]
        public CogToolBlock _B_CCD2_尾结测量工具 = null;
        //坐标变焕模块
        // public CogToolBlock _B角度2测量工具 = new CogToolBlock(); //要得到x，y，r，不管用什么方法

        public ResultFunc init()
        {
            try
            {
                //对第二次拍照部分进行赋值
                _B_CCD1_端盖测量工具 = CCD1vppblock.Tools["端盖测量"] as CogToolBlock;
                _B_CCD1_中结测量工具 = CCD1vppblock.Tools["中结测量"] as CogToolBlock;
                _B_CCD1_尾结测量工具 = CCD1vppblock.Tools["尾结测量"] as CogToolBlock;
                //
                _B_CCD2_端盖测量工具 = CCD2vppblock.Tools["端盖测量"] as CogToolBlock;
                _B_CCD2_中结测量工具 = CCD2vppblock.Tools["中结测量"] as CogToolBlock;
                _B_CCD2_尾结测量工具 = CCD2vppblock.Tools["尾结测量"] as CogToolBlock;
                //_B角度2测量工具 = CCD2vppblock.Tools["角度2测量"] as CogToolBlock;
                return new ResultFunc(Funstate.OK, "");
            }
            catch (Exception ex)
            {
                return new ResultFunc(Funstate.异常, ex.ToString());
            }

        }

    }
    [Serializable]
    public class PointR
    {
        public double X { get; set; }
        public double Y { get; set; }
        public double R { get; set; }
      //  public double Socre { get; set; }
    }

}
